#include<iostream>
#include<unistd.h>
#include<signal.h>
using std::cout;
using std::endl;

int cnt=1;
void handler(int sigNum)
{
    cout<<"I am process,i catch a signal::"<<sigNum<<",its number::"<<cnt<<endl;
    cnt++;
}

int main()
{
    signal(2,handler);
    sleep(1);
    cout<<"Process has set done!"<<endl;


    while(true)
    {
        cout<<"I am a process,my pid::"<<getpid()<<endl;
        sleep(1);
    }
    return 0;
}
